// ignore_for_file: file_names, must_be_immutable

import 'package:flutter/material.dart';

class MyApp17 extends StatelessWidget {
  MyApp17({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        //1.导航
        appBar: AppBar(
          title: const Text('CustomScrollView组件'),
          backgroundColor: Colors.pink,
        ),
        //2.内容
        body: CustomScrollView(slivers: [
          //网格
          SliverGrid.builder(
            gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
              crossAxisCount: 3,
              childAspectRatio: 1.5,
              mainAxisSpacing: 10,
              crossAxisSpacing: 10,
            ),
            itemBuilder: (BuildContext context, int index) {
              return Container(
                alignment: Alignment.center,
                color: Colors.teal,
                child: Text(
                  '第$index个',
                  style: TextStyle(color: Colors.white, fontSize: 30),
                ),
              );
            },
            itemCount: 6,
          ),
          //列表

          SliverList.builder(
            itemBuilder: (BuildContext context, int index) {
              return Container(
                width: double.infinity,
                height: 100,
                margin: EdgeInsets.all(10),
                alignment: Alignment.center,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(10),
                  color: Colors.blue,
                ),
                child: Text(
                  '第$index个',
                  style: TextStyle(color: Colors.white, fontSize: 30),
                ),
              );
            },
            itemCount: 6,
          )
        ]));
  }
}
